package com.rhb.ca.uzer.web.struts.form;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.rhb.ca.uzer.bean.Uzer;
import com.rhb.ca.uzer.bean.UzerQuery;
import com.rhb.ca.web.struts.form.ListForm;

public class UzerForm extends ListForm {

	// Fields
	private Uzer uzer;
	private UzerQuery uzerQuery;
	private Set rolesSelected;
	private List rolesNotSelected;
	private String[] rolePksSelected={};
	

	public String[] getRolePksSelected() {
		return rolePksSelected;
	}

	public void setRolePksSelected(String[] rolePksSelected) {
		this.rolePksSelected = rolePksSelected;
	}

	// default construct
	public UzerForm() {
		uzer = new Uzer();
		uzerQuery = new UzerQuery();
		rolesSelected = uzer.getRoles();
		rolesNotSelected = new ArrayList();
	}
	
	// get, set
	public Uzer getUzer() {
		return uzer;
	}

	public void setUzer(Uzer uzer) {
		this.uzer = uzer;
	}

	public UzerQuery getUzerQuery() {
		return uzerQuery;
	}

	public void setUzerQuery(UzerQuery uzerQuery) {
		this.uzerQuery = uzerQuery;
	}

	// validate
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();

		if ("add".equalsIgnoreCase(this.getBehavior()) || "edit".equalsIgnoreCase(this.getBehavior())) {
																																	}

		return errors;
	}

	public Set getRolesSelected() {
		return this.uzer.getRoles();
	}

	public void setRolesSelected(Set rolesSelected) {
		this.rolesSelected = rolesSelected;
	}

	public List getRolesNotSelected() {
		return rolesNotSelected;
	}

	public void setRolesNotSelected(List rolesNotSelected) {
		this.rolesNotSelected = rolesNotSelected;
	}
}
